import React, { Component } from 'react'
import Hello from './components/Hello'

export default class App extends Component {
  state = {
    flag: true
  }
  changeFlag = () => {
    this.setState({
      flag: !this.state.flag
    })
  }
  render () {
    const { flag } = this.state
    return (
      <div>
        <button onClick={this.changeFlag}>切换</button>
        {flag && <Hello />}
      </div>
    )
  }
}
